package com.app.xinfadi.widget;


import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;

import com.app.xinfadi.R;


public class DropDownListPopupWindow extends PopupWindow {
	private View drop_downlist_popupwindow;
	private Context context;
	private ListView drop_downlist;

	public DropDownListPopupWindow(Context context, int width, int height) {
		this.context = context;
		drop_downlist_popupwindow = LayoutInflater.from(this.context).inflate(R.layout.drop_downlist_popupwindow, null);
		drop_downlist = (ListView) drop_downlist_popupwindow.findViewById(R.id.drop_downlist);
		this.setContentView(drop_downlist_popupwindow);
		this.setWidth(width);
		this.setHeight(height);
		this.setFocusable(true);
		this.setOutsideTouchable(true);
		this.setAnimationStyle(R.style.anim_droplist_popup);

		// this.update();
		ColorDrawable dw = new ColorDrawable(0000000000);
		// 点back键和其他地方使其消失,设置了这个才能触发OnDismisslistener ，设置其他控件变化等操作
		this.setBackgroundDrawable(dw);
	}

	public DropDownListPopupWindow(Activity context) {
		this(context, 0, 0);
	}

	public void setAdapter(ListAdapter adapter) {
		drop_downlist.setAdapter(adapter);
	}
	public ListView getDrop_downlist() {
		return drop_downlist;
	}

	public void setDrop_downlist(ListView drop_downlist) {
		this.drop_downlist = drop_downlist;
	}

}
